home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / snip1292.zip / PRTSCRN.C < prev    next >
C/C++ Source or Header  |  1992-12-26  |  985b  |  54 lines

  1. /*
  2. **  PRTSC.C - Access the BIOS print screen function
  3. **
  4. **  public domain demo by Bob Stout
  5. */
  6.  
  7. #include <dos.h>
  8.  
  9. #ifdef __TURBOC__
  10.  #define FAR far
  11. #else
  12.  #define FAR _far
  13. #endif
  14.  
  15. /*
  16. **  Get screen printing status
  17. **
  18. **  0 - Ready
  19. **  1 - Screen printing in process
  20. **  2 - Error occurred last time
  21. */
  22.  
  23. int PrtScrnStat(void)
  24. {
  25.       return ((int)*((char FAR *)(0x00500000)));
  26. }
  27.  
  28. /*
  29. **  Print the current screen
  30. */
  31.  
  32. int PrtScrn(void)
  33. {
  34.  
  35.       union REGS regs;                    /* Dummy for use by int86()   */
  36.  
  37.       if (1 == PrtScrnStat())             /* Can we print now?          */
  38.             return -1;                    /* Nope, return with error    */
  39.       int86(5, ®s, ®s);             /* Issue Int 5                */
  40.       return 0;
  41. }
  42.  
  43. #ifdef TEST
  44.  
  45. #include <stdio.h>
  46.  
  47. void main(void)
  48. {
  49.       printf("PrtScrn() returned %d\n", PrtScrn());
  50.       printf("PrtScrnStat() returned %d\n", PrtScrnStat());
  51. }
  52.  
  53. #endif
  54.